package org.beholder;

import org.apache.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: ddreval;
 * Date: 18.10.12
 * Time: 15:39
 * To change this template use File | Settings | File Templates.
 */
public class ControlServlet extends AbstractServlet {

    private Logger logger = Logger.getLogger(ControlServlet.class);

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Map params = req.getParameterMap();
        if (params.size()>0) {
            updateSettings(params);
        }
        req.setAttribute(STATE_PARAM, getSettings().get(STATE_PARAM));
        req.setAttribute("date", getPreviewTime());
        req.getRequestDispatcher("/control.jsp").forward(req,resp);
        closeResources();
    }

}

